﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

#nullable disable

namespace Faser_VoteSys.Models.Database
{
    [Index(nameof(SubmissionTime), Name = "idx_Participations_SubmissionTime")]
    [Index(nameof(UserId), Name = "idx_Participations_UserID")]
    public partial class Participation
    {
        public Participation()
        {
            CompanyAwards = new HashSet<CompanyAward>();
            VoteRecords = new HashSet<VoteRecord>();
        }

        [Key]
        [Column("ParticipationID")]
        public int ParticipationId { get; set; }
        [Column("UserID")]
        public int UserId { get; set; }
        [Required]
        [StringLength(255)]
        public string ResourceFileName { get; set; }
        [Required]
        [StringLength(50)]
        public string ResourceCategory { get; set; }
        [Required]
        [StringLength(255)]
        public string CompanyName { get; set; }
        public string CompanyDescription { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime SubmissionTime { get; set; }
        [Required]
        [StringLength(50)]
        public string AuditStatus { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? AuditTime { get; set; }
        public int? VoteCount { get; set; }

        [ForeignKey(nameof(UserId))]
        [InverseProperty("Participations")]
        public virtual User User { get; set; }
        [InverseProperty(nameof(CompanyAward.Participation))]
        public virtual ICollection<CompanyAward> CompanyAwards { get; set; }
        [InverseProperty(nameof(VoteRecord.Participation))]
        public virtual ICollection<VoteRecord> VoteRecords { get; set; }
    }
}
